﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace King.Engine.GameObjects.Hud.Menu
{

    internal class ActionNode : IMenuNode
    {

        #region Fields

        private Action _action;

        #endregion


        #region Properties
        
        public MenuTree Parent { get; set; }

        public string Text
        {
            get;
            set;
        }

        public string Description
        {
            get { throw new NotImplementedException(); }
        }
        
        #endregion


        #region Constructor

        internal ActionNode(string text, Action action)
        {
            Text = text;
            _action = action;
        }

        #endregion


        #region Public Methods

        public void OnInput(MenuControl control)
        {
            if (control == MenuControl.Select)
            {
                _action();
            }
        }

        public IEnumerator<IMenuNode> GetEnumerator()
        {
            throw new NotSupportedException();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
